{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Otto商品分类——PCA\n",
    "训练集\n",
    "\n",
    "Otto数据集是著名电商Otto提供的一个多类商品分类问题，类别数=9. 每个样本有93维数值型特征（整数，可能表示某种事件发生的次数，已经进行过脱敏处理）。 \n",
    "竞赛官网：https://www.kaggle.com/c/otto-group-product-classification-challenge/data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "#导入必要的工具包\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "from sklearn.decomposition import PCA"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>feat_1</th>\n",
       "      <th>feat_2</th>\n",
       "      <th>feat_3</th>\n",
       "      <th>feat_4</th>\n",
       "      <th>feat_5</th>\n",
       "      <th>feat_6</th>\n",
       "      <th>feat_7</th>\n",
       "      <th>feat_8</th>\n",
       "      <th>feat_9</th>\n",
       "      <th>...</th>\n",
       "      <th>feat_85</th>\n",
       "      <th>feat_86</th>\n",
       "      <th>feat_87</th>\n",
       "      <th>feat_88</th>\n",
       "      <th>feat_89</th>\n",
       "      <th>feat_90</th>\n",
       "      <th>feat_91</th>\n",
       "      <th>feat_92</th>\n",
       "      <th>feat_93</th>\n",
       "      <th>target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 95 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   id  feat_1  feat_2  feat_3  feat_4  feat_5  feat_6  feat_7  feat_8  feat_9  \\\n",
       "0   1       1       0       0       0       0       0       0       0       0   \n",
       "1   2       0       0       0       0       0       0       0       1       0   \n",
       "2   3       0       0       0       0       0       0       0       1       0   \n",
       "3   4       1       0       0       1       6       1       5       0       0   \n",
       "4   5       0       0       0       0       0       0       0       0       0   \n",
       "\n",
       "   ...  feat_85  feat_86  feat_87  feat_88  feat_89  feat_90  feat_91  \\\n",
       "0  ...        1        0        0        0        0        0        0   \n",
       "1  ...        0        0        0        0        0        0        0   \n",
       "2  ...        0        0        0        0        0        0        0   \n",
       "3  ...        0        1        2        0        0        0        0   \n",
       "4  ...        1        0        0        0        0        1        0   \n",
       "\n",
       "   feat_92  feat_93   target  \n",
       "0        0        0  Class_1  \n",
       "1        0        0  Class_1  \n",
       "2        0        0  Class_1  \n",
       "3        0        0  Class_1  \n",
       "4        0        0  Class_1  \n",
       "\n",
       "[5 rows x 95 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#读取训练数据(原始数据)\n",
    "train = pd.read_csv(\"/Users/wuhuan/Desktop/Otto_train.csv\")\n",
    "train.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 准备数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_train = train['target']   \n",
    "X_train = train.drop([\"id\", \"target\"], axis=1)\n",
    "\n",
    "\n",
    "#用于存储pca变换后的特征\n",
    "train_id = train['id']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PCA降维"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "pca = PCA(n_components = 0.85)\n",
    "pca.fit(X_train)\n",
    "    \n",
    "# 在训练集和测试集降维 \n",
    "X_train_pca = pca.transform(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>feat_1_tfidf</th>\n",
       "      <th>feat_2_tfidf</th>\n",
       "      <th>feat_3_tfidf</th>\n",
       "      <th>feat_4_tfidf</th>\n",
       "      <th>feat_5_tfidf</th>\n",
       "      <th>feat_6_tfidf</th>\n",
       "      <th>feat_7_tfidf</th>\n",
       "      <th>feat_8_tfidf</th>\n",
       "      <th>feat_9_tfidf</th>\n",
       "      <th>...</th>\n",
       "      <th>feat_85_tfidf</th>\n",
       "      <th>feat_86_tfidf</th>\n",
       "      <th>feat_87_tfidf</th>\n",
       "      <th>feat_88_tfidf</th>\n",
       "      <th>feat_89_tfidf</th>\n",
       "      <th>feat_90_tfidf</th>\n",
       "      <th>feat_91_tfidf</th>\n",
       "      <th>feat_92_tfidf</th>\n",
       "      <th>feat_93_tfidf</th>\n",
       "      <th>target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.081393</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.075886</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.231403</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.199730</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>0.011987</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.011668</td>\n",
       "      <td>0.105971</td>\n",
       "      <td>0.021681</td>\n",
       "      <td>0.080435</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.008244</td>\n",
       "      <td>0.022456</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.124622</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.145988</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 95 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   id  feat_1_tfidf  feat_2_tfidf  feat_3_tfidf  feat_4_tfidf  feat_5_tfidf  \\\n",
       "0   1      0.081393           0.0           0.0      0.000000      0.000000   \n",
       "1   2      0.000000           0.0           0.0      0.000000      0.000000   \n",
       "2   3      0.000000           0.0           0.0      0.000000      0.000000   \n",
       "3   4      0.011987           0.0           0.0      0.011668      0.105971   \n",
       "4   5      0.000000           0.0           0.0      0.000000      0.000000   \n",
       "\n",
       "   feat_6_tfidf  feat_7_tfidf  feat_8_tfidf  feat_9_tfidf  ...  feat_85_tfidf  \\\n",
       "0      0.000000      0.000000      0.000000           0.0  ...       0.075886   \n",
       "1      0.000000      0.000000      0.231403           0.0  ...       0.000000   \n",
       "2      0.000000      0.000000      0.199730           0.0  ...       0.000000   \n",
       "3      0.021681      0.080435      0.000000           0.0  ...       0.000000   \n",
       "4      0.000000      0.000000      0.000000           0.0  ...       0.124622   \n",
       "\n",
       "   feat_86_tfidf  feat_87_tfidf  feat_88_tfidf  feat_89_tfidf  feat_90_tfidf  \\\n",
       "0       0.000000       0.000000            0.0            0.0       0.000000   \n",
       "1       0.000000       0.000000            0.0            0.0       0.000000   \n",
       "2       0.000000       0.000000            0.0            0.0       0.000000   \n",
       "3       0.008244       0.022456            0.0            0.0       0.000000   \n",
       "4       0.000000       0.000000            0.0            0.0       0.145988   \n",
       "\n",
       "   feat_91_tfidf  feat_92_tfidf  feat_93_tfidf   target  \n",
       "0            0.0            0.0            0.0  Class_1  \n",
       "1            0.0            0.0            0.0  Class_1  \n",
       "2            0.0            0.0            0.0  Class_1  \n",
       "3            0.0            0.0            0.0  Class_1  \n",
       "4            0.0            0.0            0.0  Class_1  \n",
       "\n",
       "[5 rows x 95 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#读取训练数据（tfidf特征数据）\n",
    "train1 = pd.read_csv(\"/Users/wuhuan/Desktop/Otto_FE_train_tfidf.csv\")\n",
    "train1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_train1 = train1['target']   \n",
    "X_train1 = train1.drop([\"id\", \"target\"], axis=1)\n",
    "\n",
    "#用于存储pca变换后的特征\n",
    "train1_id = train1['id']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "pca1 = PCA(n_components = 0.85)\n",
    "pca1.fit(X_train1)\n",
    "    \n",
    "# 在训练集和测试集降维 \n",
    "X_train_pca1 = pca1.transform(X_train1)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 绘制PCA维的方差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD8CAYAAACfF6SlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAEkVJREFUeJzt3X+MXedd5/H3B7tJ2QBJmxhU8kM2J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uZiI4r6qeSfIi4P8BPwm8BfhAVR1I8t+Bj1TV70yy1lNOU/OPA39aVXf1Oc56vfPvMyWFVqCq/g+DJ7qGDU/vcQeD//BTY5Gap1pVfbqqHuyW/wl4lMG346f2XJ+m5qlVA890qy/qfgr4HgZT1cD0nefFal6W9Rr+Z+u0EgX8RZIHum89ny2+qqo+DYMAAL5ywvX0tSfJw92w0NQMn4zqZsn9JuB+zpJzPVIzTPG5TrIhyUPAk8CHgE8An+umqoEpzI/Rmqvq1Hl+Z3eeb0ly7umOsV7DPwu0nQ3jW99eVd/MYAbVn+iGK3Rm/A7wtcCVwKeBX59sOQtL8mXA+4Gfqqp/nHQ9fSxQ81Sf66r6QlVdyWAGgm3ANyzUbW2rOr3RmpO8Angr8PXAq4CXAqcdDlyv4d9rWolpU1XHun+fBD7I2TMD6me68d5T475PTrieJVXVZ7r/QM8Dv8cUnutuPPf9wB9W1Qe65qk+1wvVfDaca4Cq+hzwv4BvAy7IYKoamOL8GKp5ezfsVlX1eeAPWOI8r9fw7zMlxVRJcl73IRlJzgOuBj52+r2mxvD0HtcDfzLBWno5FaCdH2DKznX3od5twKNV9RtDm6b2XC9W8zSf6ySbklzQLX8p8L0MPqv4SwZT1cD0neeFav6boZuCMPiM4rTneV0+7QPQPU72m3xxSopJfcu4lyRfw+BuHwbfvH7vNNac5I+A72Ywi+BngLcBfwzcCVwGfBLYWVVT8wHrIjV/N4NhiAKOAj92aix9GiT5DuD/Ah8Fnu+af4HBGPpUnuvT1HwdU3quk7ySwQe6GxjcDN9ZVfu6/48HGAyffBj4L90d9cSdpuZ7gU0Mhr0fAn586IPhFx5nvYa/JGlx63XYR5J0Goa/JDXI8JekBhn+ktQgw1+SGmT4S1KDDH9JapDhL0kN+jfZjuqp1wAnYAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#原始数据的PCA方差图\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "plt.bar(range(len(pca.explained_variance_ratio_)), pca.explained_variance_ratio_)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. 观察Otto商品的特征进行PCA各维的方差，可以得到什么结论？（20分）\n",
    "\n",
    "      从图中可以看出通过PCA降维，保留了33维，占据85%的方差，剩下的60维仅占比15%，被舍去。前4个特征占据较大的方差百分比，大约是32%，保留的最后几个单个成分约占1%，可以判断剩下60维的单个成分占比不足1%，由此去除了大部分冗余数据，获取了主要数据成分，有利于提升模型的计算效率。\n",
    "      "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAEA9JREFUeJzt3H+s3fVdx/Hny3bA3CJsUM1swXahmnUZTnfXLXHqMpQVmesSIZb5oyaYajLMjJuzGMe2OhMwZt0SMbEZaGVqIcwfN1IlBOaPLAvrZbgfHZLdIY5ryShrx8QFurK3f5wv2fFwy/3ee8/t5d7P85E0fL+f7+d7zucTcl+fz/mc7/mkqpAkteG7lrsBkqTTx9CXpIYY+pLUEENfkhpi6EtSQwx9SWqIoS9JDTH0Jakhhr4kNWTtcjdg1HnnnVcbN25c7mZI0opy7733PlZV6+aq97wL/Y0bNzI1NbXczZCkFSXJf/Wp5/KOJDXE0Jekhhj6ktQQQ1+SGmLoS1JDDH1JaoihL0kNMfQlqSGGviQ1pNcvcpNsAz4CrAE+WlXXjVz/CeDDwEXAjqq6bejaTuD3utMPVtX+cTT8VDbuvv1ZZQ9dd9lS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uifKnbIuWM5W7rUkmyJsl9Sf6hO2+m7wux6kK/57YRq82fM9jmYthu4K6q2gzc1Z2vRieBd1XVK4DXA+/o/n+30v+ngDdV1Q8Drwa2JXk9g61Q9nb9P85gq5TV6p3A/UPnLfV93lZd6NNv24hVpar+lcFTU8OGt8bYD7zttDbqNKmqR6rqM93x/zD4419PO/2vqnqiO31B96+ANzHYEgVWcf+TbAAuAz7anYdG+r5QqzH03fph4Puq6hEYBCPwvcvcniXX7e76I8A9NNT/bnnj34FHgTuBLwNf77ZEgdX9N/Bh4D3At7vzc2mn7wuyGkM/s5T5iNIql+TFwMeB36yqbyx3e06nqnq6ql7N4BfvW4FXzFbt9LZq6SV5C/BoVd07XDxL1VXX98Xosw3DStNr64cGfDXJy6rqkSQvYzALXJWSvIBB4P9lVf1NV9xM/59RVV9P8s8Mvts4J8nabsa7Wv8Gfgx4a5KfAc4CvofBzL+Fvi/Yapzp99k2ogXDW2PsBP5+GduyZLo13BuB+6vqQ0OXWun/uiTndMcvBH6Kwfcan2CwJQqs0v5X1TVVtaGqNjL4O7+7qn6BBvq+GKvyx1ndyP9hvrNtxB8sc5OWVJK/Bt7IYHfBrwLvA/4OuBW4APgKcEVVjX7Zu+IleQPwb8Dn+c667u8yWNdvof8XMfiycg2DSdytVbUnycsZPMTwUuA+4Ber6qnla+nSSvJG4N1V9ZbW+j5fqzL0JUmzW43LO5KkUzD0Jakhhr4kNcTQl6SGGPqS1BBDX5IaYuhLUkMMfUlqyP8Bst/13MP2gdUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# tfidf特征PCA方差图\n",
    "plt.bar(range(len(pca1.explained_variance_ratio_)), pca1.explained_variance_ratio_)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2. 对Otto商品tfidf特征，进行PCA降维，给出各维方差的分布图。（30分）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 保存结果，PCA降维后的表示可作为特征提取的一部分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#保存PCA特征变换结果（原始数据）\n",
    "n_components = pca.n_components_\n",
    "feat_names_pca = []\n",
    "for i in range(n_components):\n",
    "    feat_names_pca.append(\"pca_\" + str(i))\n",
    "\n",
    "y = pd.Series(data = y_train, name = 'target')\n",
    "train_pca = pd.concat([train_id, pd.DataFrame(columns = feat_names_pca, data = X_train_pca), y], axis = 1)\n",
    "train_pca.to_csv('Otto_FE_train_PCA.csv',index=False,header=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3. 采用train_test_split，从将数据集中随机抽取10000条记录（原始数据集太大，剩余数据抛弃，此部分SVM作业已经完成）。对这部分数据进行PCA降维，保留85%的能量。（20分） "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/wuhuan/anaconda3/envs/tensorflow/lib/python3.6/site-packages/sklearn/model_selection/_split.py:2179: FutureWarning: From version 0.21, test_size will always complement train_size unless both are specified.\n",
      "  FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "# 数据分割\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "#X_train_part, X_val, y_train_part, y_val = train_test_split(X_train, y_train, train_size = 10000,random_state = 0)\n",
    "X_train_part, X_val= train_test_split(train1, train_size = 10000,random_state = 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(51878, 95)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>feat_1_tfidf</th>\n",
       "      <th>feat_2_tfidf</th>\n",
       "      <th>feat_3_tfidf</th>\n",
       "      <th>feat_4_tfidf</th>\n",
       "      <th>feat_5_tfidf</th>\n",
       "      <th>feat_6_tfidf</th>\n",
       "      <th>feat_7_tfidf</th>\n",
       "      <th>feat_8_tfidf</th>\n",
       "      <th>feat_9_tfidf</th>\n",
       "      <th>...</th>\n",
       "      <th>feat_85_tfidf</th>\n",
       "      <th>feat_86_tfidf</th>\n",
       "      <th>feat_87_tfidf</th>\n",
       "      <th>feat_88_tfidf</th>\n",
       "      <th>feat_89_tfidf</th>\n",
       "      <th>feat_90_tfidf</th>\n",
       "      <th>feat_91_tfidf</th>\n",
       "      <th>feat_92_tfidf</th>\n",
       "      <th>feat_93_tfidf</th>\n",
       "      <th>target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>4449</th>\n",
       "      <td>4450</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.049480</td>\n",
       "      <td>0.797608</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.044613</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38075</th>\n",
       "      <td>38076</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.124004</td>\n",
       "      <td>0.093721</td>\n",
       "      <td>0.699647</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.188119</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32087</th>\n",
       "      <td>32088</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.083045</td>\n",
       "      <td>0.282442</td>\n",
       "      <td>0.117138</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.031496</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43081</th>\n",
       "      <td>43082</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.239131</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36326</th>\n",
       "      <td>36327</td>\n",
       "      <td>0.02541</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.037441</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.042575</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.162067</td>\n",
       "      <td>0.025932</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 95 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          id  feat_1_tfidf  feat_2_tfidf  feat_3_tfidf  feat_4_tfidf  \\\n",
       "4449    4450       0.00000      0.000000      0.000000      0.000000   \n",
       "38075  38076       0.00000      0.124004      0.093721      0.699647   \n",
       "32087  32088       0.00000      0.083045      0.282442      0.117138   \n",
       "43081  43082       0.00000      0.000000      0.000000      0.000000   \n",
       "36326  36327       0.02541      0.000000      0.000000      0.000000   \n",
       "\n",
       "       feat_5_tfidf  feat_6_tfidf  feat_7_tfidf  feat_8_tfidf  feat_9_tfidf  \\\n",
       "4449       0.000000           0.0           0.0      0.049480      0.797608   \n",
       "38075      0.000000           0.0           0.0      0.000000      0.000000   \n",
       "32087      0.000000           0.0           0.0      0.000000      0.000000   \n",
       "43081      0.000000           0.0           0.0      0.000000      0.000000   \n",
       "36326      0.037441           0.0           0.0      0.042575      0.000000   \n",
       "\n",
       "       ...  feat_85_tfidf  feat_86_tfidf  feat_87_tfidf  feat_88_tfidf  \\\n",
       "4449   ...            0.0            0.0       0.000000       0.044613   \n",
       "38075  ...            0.0            0.0       0.000000       0.000000   \n",
       "32087  ...            0.0            0.0       0.000000       0.000000   \n",
       "43081  ...            0.0            0.0       0.239131       0.000000   \n",
       "36326  ...            0.0            0.0       0.000000       0.000000   \n",
       "\n",
       "       feat_89_tfidf  feat_90_tfidf  feat_91_tfidf  feat_92_tfidf  \\\n",
       "4449        0.000000            0.0       0.000000       0.000000   \n",
       "38075       0.188119            0.0       0.000000       0.000000   \n",
       "32087       0.031496            0.0       0.000000       0.000000   \n",
       "43081       0.000000            0.0       0.000000       0.000000   \n",
       "36326       0.000000            0.0       0.162067       0.025932   \n",
       "\n",
       "       feat_93_tfidf   target  \n",
       "4449             0.0  Class_2  \n",
       "38075            0.0  Class_6  \n",
       "32087            0.0  Class_6  \n",
       "43081            0.0  Class_6  \n",
       "36326            0.0  Class_6  \n",
       "\n",
       "[5 rows x 95 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print (X_val.shape)\n",
    "X_val.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(10000, 95)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>feat_1_tfidf</th>\n",
       "      <th>feat_2_tfidf</th>\n",
       "      <th>feat_3_tfidf</th>\n",
       "      <th>feat_4_tfidf</th>\n",
       "      <th>feat_5_tfidf</th>\n",
       "      <th>feat_6_tfidf</th>\n",
       "      <th>feat_7_tfidf</th>\n",
       "      <th>feat_8_tfidf</th>\n",
       "      <th>feat_9_tfidf</th>\n",
       "      <th>...</th>\n",
       "      <th>feat_85_tfidf</th>\n",
       "      <th>feat_86_tfidf</th>\n",
       "      <th>feat_87_tfidf</th>\n",
       "      <th>feat_88_tfidf</th>\n",
       "      <th>feat_89_tfidf</th>\n",
       "      <th>feat_90_tfidf</th>\n",
       "      <th>feat_91_tfidf</th>\n",
       "      <th>feat_92_tfidf</th>\n",
       "      <th>feat_93_tfidf</th>\n",
       "      <th>target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>7897</th>\n",
       "      <td>7898</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.242627</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.266458</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11287</th>\n",
       "      <td>11288</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.067614</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.074256</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10355</th>\n",
       "      <td>10356</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.201673</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.331142</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13438</th>\n",
       "      <td>13439</td>\n",
       "      <td>0.129754</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.089243</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.196017</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54129</th>\n",
       "      <td>54130</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.100217</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.065327</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 95 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          id  feat_1_tfidf  feat_2_tfidf  feat_3_tfidf  feat_4_tfidf  \\\n",
       "7897    7898      0.000000           0.0           0.0           0.0   \n",
       "11287  11288      0.000000           0.0           0.0           0.0   \n",
       "10355  10356      0.000000           0.0           0.0           0.0   \n",
       "13438  13439      0.129754           0.0           0.0           0.0   \n",
       "54129  54130      0.000000           0.0           0.0           0.0   \n",
       "\n",
       "       feat_5_tfidf  feat_6_tfidf  feat_7_tfidf  feat_8_tfidf  feat_9_tfidf  \\\n",
       "7897            0.0           0.0           0.0      0.000000           0.0   \n",
       "11287           0.0           0.0           0.0      0.000000           0.0   \n",
       "10355           0.0           0.0           0.0      0.201673           0.0   \n",
       "13438           0.0           0.0           0.0      0.000000           0.0   \n",
       "54129           0.0           0.0           0.0      0.100217           0.0   \n",
       "\n",
       "       ...  feat_85_tfidf  feat_86_tfidf  feat_87_tfidf  feat_88_tfidf  \\\n",
       "7897   ...            0.0       0.242627            0.0       0.266458   \n",
       "11287  ...            0.0       0.067614            0.0       0.074256   \n",
       "10355  ...            0.0       0.331142            0.0       0.000000   \n",
       "13438  ...            0.0       0.089243            0.0       0.196017   \n",
       "54129  ...            0.0       0.000000            0.0       0.000000   \n",
       "\n",
       "       feat_89_tfidf  feat_90_tfidf  feat_91_tfidf  feat_92_tfidf  \\\n",
       "7897             0.0       0.000000            0.0            0.0   \n",
       "11287            0.0       0.000000            0.0            0.0   \n",
       "10355            0.0       0.000000            0.0            0.0   \n",
       "13438            0.0       0.000000            0.0            0.0   \n",
       "54129            0.0       0.065327            0.0            0.0   \n",
       "\n",
       "       feat_93_tfidf   target  \n",
       "7897             0.0  Class_2  \n",
       "11287            0.0  Class_2  \n",
       "10355            0.0  Class_2  \n",
       "13438            0.0  Class_2  \n",
       "54129            0.0  Class_8  \n",
       "\n",
       "[5 rows x 95 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print (X_train_part.shape)\n",
    "X_train_part.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train_part.to_csv('X_train_part.csv',index=False,header=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_val.to_csv('X_val.csv',index=False,header=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>feat_1_tfidf</th>\n",
       "      <th>feat_2_tfidf</th>\n",
       "      <th>feat_3_tfidf</th>\n",
       "      <th>feat_4_tfidf</th>\n",
       "      <th>feat_5_tfidf</th>\n",
       "      <th>feat_6_tfidf</th>\n",
       "      <th>feat_7_tfidf</th>\n",
       "      <th>feat_8_tfidf</th>\n",
       "      <th>feat_9_tfidf</th>\n",
       "      <th>...</th>\n",
       "      <th>feat_85_tfidf</th>\n",
       "      <th>feat_86_tfidf</th>\n",
       "      <th>feat_87_tfidf</th>\n",
       "      <th>feat_88_tfidf</th>\n",
       "      <th>feat_89_tfidf</th>\n",
       "      <th>feat_90_tfidf</th>\n",
       "      <th>feat_91_tfidf</th>\n",
       "      <th>feat_92_tfidf</th>\n",
       "      <th>feat_93_tfidf</th>\n",
       "      <th>target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>7898</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.242627</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.266458</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>11288</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.067614</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.074256</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10356</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.201673</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.331142</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>13439</td>\n",
       "      <td>0.129754</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.089243</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.196017</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>54130</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.100217</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.065327</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 95 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      id  feat_1_tfidf  feat_2_tfidf  feat_3_tfidf  feat_4_tfidf  \\\n",
       "0   7898      0.000000           0.0           0.0           0.0   \n",
       "1  11288      0.000000           0.0           0.0           0.0   \n",
       "2  10356      0.000000           0.0           0.0           0.0   \n",
       "3  13439      0.129754           0.0           0.0           0.0   \n",
       "4  54130      0.000000           0.0           0.0           0.0   \n",
       "\n",
       "   feat_5_tfidf  feat_6_tfidf  feat_7_tfidf  feat_8_tfidf  feat_9_tfidf  ...  \\\n",
       "0           0.0           0.0           0.0      0.000000           0.0  ...   \n",
       "1           0.0           0.0           0.0      0.000000           0.0  ...   \n",
       "2           0.0           0.0           0.0      0.201673           0.0  ...   \n",
       "3           0.0           0.0           0.0      0.000000           0.0  ...   \n",
       "4           0.0           0.0           0.0      0.100217           0.0  ...   \n",
       "\n",
       "   feat_85_tfidf  feat_86_tfidf  feat_87_tfidf  feat_88_tfidf  feat_89_tfidf  \\\n",
       "0            0.0       0.242627            0.0       0.266458            0.0   \n",
       "1            0.0       0.067614            0.0       0.074256            0.0   \n",
       "2            0.0       0.331142            0.0       0.000000            0.0   \n",
       "3            0.0       0.089243            0.0       0.196017            0.0   \n",
       "4            0.0       0.000000            0.0       0.000000            0.0   \n",
       "\n",
       "   feat_90_tfidf  feat_91_tfidf  feat_92_tfidf  feat_93_tfidf   target  \n",
       "0       0.000000            0.0            0.0            0.0  Class_2  \n",
       "1       0.000000            0.0            0.0            0.0  Class_2  \n",
       "2       0.000000            0.0            0.0            0.0  Class_2  \n",
       "3       0.000000            0.0            0.0            0.0  Class_2  \n",
       "4       0.065327            0.0            0.0            0.0  Class_8  \n",
       "\n",
       "[5 rows x 95 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dpath = './data/'\n",
    "train2 = pd.read_csv(dpath +\"X_train_part.csv\")\n",
    "val = pd.read_csv(dpath +\"X_val.csv\")\n",
    "\n",
    "train2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>feat_1_tfidf</th>\n",
       "      <th>feat_2_tfidf</th>\n",
       "      <th>feat_3_tfidf</th>\n",
       "      <th>feat_4_tfidf</th>\n",
       "      <th>feat_5_tfidf</th>\n",
       "      <th>feat_6_tfidf</th>\n",
       "      <th>feat_7_tfidf</th>\n",
       "      <th>feat_8_tfidf</th>\n",
       "      <th>feat_9_tfidf</th>\n",
       "      <th>...</th>\n",
       "      <th>feat_85_tfidf</th>\n",
       "      <th>feat_86_tfidf</th>\n",
       "      <th>feat_87_tfidf</th>\n",
       "      <th>feat_88_tfidf</th>\n",
       "      <th>feat_89_tfidf</th>\n",
       "      <th>feat_90_tfidf</th>\n",
       "      <th>feat_91_tfidf</th>\n",
       "      <th>feat_92_tfidf</th>\n",
       "      <th>feat_93_tfidf</th>\n",
       "      <th>target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>4450</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.049480</td>\n",
       "      <td>0.797608</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.044613</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>38076</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.124004</td>\n",
       "      <td>0.093721</td>\n",
       "      <td>0.699647</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.188119</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>32088</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.083045</td>\n",
       "      <td>0.282442</td>\n",
       "      <td>0.117138</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.031496</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>43082</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.239131</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>36327</td>\n",
       "      <td>0.02541</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.037441</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.042575</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.162067</td>\n",
       "      <td>0.025932</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Class_6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 95 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      id  feat_1_tfidf  feat_2_tfidf  feat_3_tfidf  feat_4_tfidf  \\\n",
       "0   4450       0.00000      0.000000      0.000000      0.000000   \n",
       "1  38076       0.00000      0.124004      0.093721      0.699647   \n",
       "2  32088       0.00000      0.083045      0.282442      0.117138   \n",
       "3  43082       0.00000      0.000000      0.000000      0.000000   \n",
       "4  36327       0.02541      0.000000      0.000000      0.000000   \n",
       "\n",
       "   feat_5_tfidf  feat_6_tfidf  feat_7_tfidf  feat_8_tfidf  feat_9_tfidf  ...  \\\n",
       "0      0.000000           0.0           0.0      0.049480      0.797608  ...   \n",
       "1      0.000000           0.0           0.0      0.000000      0.000000  ...   \n",
       "2      0.000000           0.0           0.0      0.000000      0.000000  ...   \n",
       "3      0.000000           0.0           0.0      0.000000      0.000000  ...   \n",
       "4      0.037441           0.0           0.0      0.042575      0.000000  ...   \n",
       "\n",
       "   feat_85_tfidf  feat_86_tfidf  feat_87_tfidf  feat_88_tfidf  feat_89_tfidf  \\\n",
       "0            0.0            0.0       0.000000       0.044613       0.000000   \n",
       "1            0.0            0.0       0.000000       0.000000       0.188119   \n",
       "2            0.0            0.0       0.000000       0.000000       0.031496   \n",
       "3            0.0            0.0       0.239131       0.000000       0.000000   \n",
       "4            0.0            0.0       0.000000       0.000000       0.000000   \n",
       "\n",
       "   feat_90_tfidf  feat_91_tfidf  feat_92_tfidf  feat_93_tfidf   target  \n",
       "0            0.0       0.000000       0.000000            0.0  Class_2  \n",
       "1            0.0       0.000000       0.000000            0.0  Class_6  \n",
       "2            0.0       0.000000       0.000000            0.0  Class_6  \n",
       "3            0.0       0.000000       0.000000            0.0  Class_6  \n",
       "4            0.0       0.162067       0.025932            0.0  Class_6  \n",
       "\n",
       "[5 rows x 95 columns]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_real_train = train2['target']   \n",
    "X_real_train = train2.drop([\"id\", \"target\"], axis=1)\n",
    "\n",
    "\n",
    "#用于存储pca变换后的特征\n",
    "train_real_id = train2['id']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_real_val = val['target']   \n",
    "X_real_val = val.drop([\"id\", \"target\"], axis=1)\n",
    "\n",
    "\n",
    "#用于存储pca变换后的特征\n",
    "val_real_id = val['id']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "pca2 = PCA(n_components = 0.85)\n",
    "pca2.fit(X_real_train)\n",
    "pca2.fit(X_real_val)\n",
    "\n",
    "    \n",
    "# 在训练集和测试集降维 \n",
    "X_train_pca2 = pca2.transform(X_real_train)\n",
    "X_val_pca2 = pca2.transform(X_real_val)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAEAlJREFUeJzt3X+sX/Vdx/Hny3bA3CJspTOzpd4uVLNOcWrXLXHqAg6KTLpEiGX+wARTTYaZ2ZZZjLKtzgSMWWciJjYDbTYVCPNHI1VCYP7IQljL2MY6JLtDHHclo9iOiQuwsrd/fA/u65db7rn3fm9v+/08H0nTcz7nc77fzyekr/P5fs45H1JVSJLa8F3L3QBJ0olj6EtSQwx9SWqIoS9JDTH0Jakhhr4kNcTQl6SGGPqS1BBDX5IasnK5GzDq7LPPrqmpqeVuhiSdUu67774nqmr1XPVOutCfmpriwIEDy90MSTqlJPnPPvWc3pGkhhj6ktQQQ1+SGmLoS1JDDH1JaoihL0kNMfQlqSGGviQ1xNCXpIb0eiM3yRbgj4EVwEer6rqR4z8FfAQ4D9hWVbcNHbsS+N1u90NVtWccDT+eqR23v6DskesuWcqvlKRTxpwj/SQrgBuAi4GNwBVJNo5U+wrwq8BfjZz7SuD9wBuBzcD7k7xi8c2WJC1En+mdzcB0VT1cVc8CNwNbhytU1SNV9Xng2yPnXgTcWVVHquoocCewZQztliQtQJ/QXwM8OrQ/05X10evcJNu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Kp3gU8OLTfUt/nbeJCn37LRkyUqvpXBk9NDRteGmMP8PYT2qgTpKoeq6rPdNv/zeAf/xra6X9V1VPd7ku6PwWcz2BJFJjg/idZC1wCfLTbD430faEmMfRd+mHge6vqMRgEI/CqZW7PkutWd/1R4F4a6n83vfFZ4HHgTuDLwNe7JVFgsv8NfAR4H/Dtbn8V7fR9QSYx9DNLmY8oTbgkLwc+AfxWVX1judtzIlXVc1X1egZvvG8GXjtbtRPbqqWX5G3A41V133DxLFUnru+L0WcZhlNNr6UfGvC1JK+uqseSvJrBKHAiJXkJg8D/y6r6m664mf4/r6q+nuSfGdzbOCvJym7EO6n/Bn4CuDTJzwJnAN/DYOTfQt8XbBJH+n2WjWjB8NIYVwJ/v4xtWTLdHO6NwINV9eGhQ630f3WSs7rtlwI/w+C+xicZLIkCE9r/qrqmqtZW1RSDf+d3V9Uv0kDfF2MiX87qrvwf4TvLRvzBMjdpSSX5a+AtDFYX/BrwfuDvgFuBdcBXgMuravRm7ykvyZuBfwMe4Dvzur/DYF6/hf6fx+Bm5QoGg7hbq2pnktcweIjhlcD9wC9V1TPL19KlleQtwHur6m2t9X2+JjL0JUmzm8TpHUnScRj6ktQQQ1+SGmLoS1JDDH1JaoihL0kNMfQlqSGGviQ15H8BEG7uNW8uozQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.bar(range(len(pca2.explained_variance_ratio_)), pca2.explained_variance_ratio_)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "#保存PCA特征变换结果（数据分割后的PCA）\n",
    "n_components = pca2.n_components_\n",
    "feat_names_pca2 = []\n",
    "for i in range(n_components):\n",
    "    feat_names_pca2.append(\"pca2_\" + str(i))\n",
    "\n",
    "y2 = pd.Series(data = y_real_train, name = 'target')\n",
    "train_pca2 = pd.concat([train_real_id, pd.DataFrame(columns = feat_names_pca2, data = X_train_pca2), y2], axis = 1)\n",
    "train_pca2.to_csv('Otto_homework_train_PCAmm.csv',index=False,header=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4. 对3中得到的数据（对降维后的数据），训练RBF核SVM，并对超参数（C和gamma）进行超参数调优。结果和用原始数据的情况比较（SVM部分作业结果）。（30分）\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import accuracy_score\n",
    "\n",
    "from sklearn.metrics import classification_report\n",
    "from sklearn.metrics import confusion_matrix\n",
    "\n",
    "from sklearn.svm import SVC\n",
    "def fit_grid_point_RBF(C, gamma, X_train_pca2, y_real_train, X_val_pca2, y_real_val):\n",
    "    \n",
    "    # 在训练集是那个利用SVC训练\n",
    "    SVC1 =  SVC( C = C, kernel='rbf', gamma = gamma)\n",
    "    SVC1 = SVC1.fit(X_train_pca2, y_real_train)\n",
    "    \n",
    "    # 在校验集上返回accuracy\n",
    "    accuracy = SVC1.score(X_val_pca2, y_real_val)\n",
    "    \n",
    "    print(\"C= {} and gamma = {}: accuracy= {} \" .format(C, gamma, accuracy))\n",
    "    return accuracy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "accuracy_s = np.matrix(np.zeros(shape=(5, 5)), float)\n",
    "gamma_s = np.logspace(-2, 2, 5)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C= 0.1 and gamma = 0.01: accuracy= 0.47773622730251747 \n",
      "C= 0.1 and gamma = 0.1: accuracy= 0.7052700566714214 \n",
      "C= 0.1 and gamma = 1.0: accuracy= 0.7335864913836309 \n",
      "C= 0.1 and gamma = 10.0: accuracy= 0.5444504414202552 \n",
      "C= 0.1 and gamma = 100.0: accuracy= 0.2720420987701916 \n"
     ]
    }
   ],
   "source": [
    "oneC = 0.1\n",
    "\n",
    "for j, gamma in enumerate(gamma_s):\n",
    "    accuracy_s[0,j] = fit_grid_point_RBF(oneC, gamma, X_train_pca2, y_real_train, X_val_pca2, y_real_val)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C= 1 and gamma = 0.01: accuracy= 0.7057905085007132 \n",
      "C= 1 and gamma = 0.1: accuracy= 0.7376151740622229 \n",
      "C= 1 and gamma = 1.0: accuracy= 0.7675122402559852 \n",
      "C= 1 and gamma = 10.0: accuracy= 0.737538070087513 \n",
      "C= 1 and gamma = 100.0: accuracy= 0.32154285053394505 \n"
     ]
    }
   ],
   "source": [
    "oneC = 1\n",
    "\n",
    "for j, gamma in enumerate(gamma_s):\n",
    "    accuracy_s[1,j] = fit_grid_point_RBF(oneC, gamma, X_train_pca2, y_real_train, X_val_pca2, y_real_val)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C= 10 and gamma = 0.01: accuracy= 0.7372489301823509 \n",
      "C= 10 and gamma = 0.1: accuracy= 0.758760939126412 \n",
      "C= 10 and gamma = 1.0: accuracy= 0.7842630787617102 \n",
      "C= 10 and gamma = 10.0: accuracy= 0.7438605960137246 \n",
      "C= 10 and gamma = 100.0: accuracy= 0.3367708855391495 \n"
     ]
    }
   ],
   "source": [
    "oneC = 10\n",
    "\n",
    "for j, gamma in enumerate(gamma_s):\n",
    "    accuracy_s[1,j] = fit_grid_point_RBF(oneC, gamma, X_train_pca2, y_real_train, X_val_pca2, y_real_val)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C= 100 and gamma = 0.01: accuracy= 0.7512047496048422 \n",
      "C= 100 and gamma = 0.1: accuracy= 0.7757430895562666 \n",
      "C= 100 and gamma = 1.0: accuracy= 0.7674351362812754 \n",
      "C= 100 and gamma = 10.0: accuracy= 0.7404487451328116 \n",
      "C= 100 and gamma = 100.0: accuracy= 0.3367708855391495 \n"
     ]
    }
   ],
   "source": [
    "oneC = 100\n",
    "\n",
    "for j, gamma in enumerate(gamma_s):\n",
    "    accuracy_s[1,j] = fit_grid_point_RBF(oneC, gamma, X_train_pca2, y_real_train, X_val_pca2, y_real_val)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C= 1000 and gamma = 0.01: accuracy= 0.7621727900073249 \n",
      "C= 1000 and gamma = 0.1: accuracy= 0.7736420062454219 \n",
      "C= 1000 and gamma = 1.0: accuracy= 0.7551948802960793 \n",
      "C= 1000 and gamma = 10.0: accuracy= 0.7405644010948764 \n",
      "C= 1000 and gamma = 100.0: accuracy= 0.3367708855391495 \n"
     ]
    }
   ],
   "source": [
    "oneC = 1000\n",
    "\n",
    "for j, gamma in enumerate(gamma_s):\n",
    "    accuracy_s[1,j] = fit_grid_point_RBF(oneC, gamma, X_train_pca2, y_real_train, X_val_pca2, y_real_val)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "最佳参数C= 10 ，gamma = 1.0。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xl4VOXZ+PHvM8kkk2RCdtYQAgQEZN9EsBatVhTRarXWFXCv2l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HXHFfAD2YMPfwblFIqCk0KXUy8Xvbc8Auq3nqLnOt/RvZll7W6j9fW7eGBtzdz2qTBXP/d0RZEqZTqKzQpdCHxeNhz/fVUrX6H/jfeSNbiRa3uY83OUm748xfMzM/kgbMnahlspVS7aFLoIgGPhz3X/pTqf/yDAb/8JZkXXtDqPr4+WMNlz65lSEYSv79wGonxsZ/prJRS0WhS6AIBl4uiH/+Emn/9i4G//hUZP/xhq/sorfGweOnH2Ixh6aIZZKTEVi1VKaVaokmhkwVqaym6+mpqPviQQXf9D+lnndXqPlxeP5c9u5biChcrLjuK/OzYLsGplFKHo0mhEwVqaij80VUcWrOGQffcQ/oZ32t9HwHh53/+nE92lfHYeVOZNizTgkiVUn2VJoVO4q+uofCKK6j97DMG338/aQtObVM/D/xtM298sZcb541h/sRBHRyl6kxer5eioiJcLldXh6J6EYfDQW5uLvYYr7fSmCaFTuCvqqLwssupXb+eIQ8/RL9589rUz4qPd/PEe9s5d2YeV357RAdHqTpbUVERqamp5Ofn61FjqkOICCUlJRQVFTF8eNtK5etV2y3mr6hg9yWXUrthA0N+80ibE8L7Ww5w66tfcuzoHP7n9CN1EOkFXC4XWVlZ+rtUHcYYQ1ZWVru2PnVLwUK+sjIKL7kU99at5D76KKnHH9emfjbtreSqP3zKqP5OHjtvCvFxmst7C00IqqO1929KRxeL+EpL2b34YtzbtpH72O/anBC+qXRx8bI1pCTGsXTxDFIdbZsnVKolRx11FJMnTyYvL4+cnBwmT57M5MmT2blzZ6v6efnll/nqq69a/fnHHHMM69ata/X76jz44IP88Y9/bPP7O8PZZ5/Njh07or721ltvMXXqVCZMmMC0adN47733orYrKSnhO9/5DqNGjeKkk06ioqKiw+PUpGAB38GD7F64EM/XX5P7xOM4jz22Tf3UuH1cvGwNFbVenl44g0FpSR0cqVJBH330EevWrePOO+/knHPOYd26daxbt478/PxW9dPWpNAeXq+X5557jnPOOadTP7e1rrzySh544IGor/Xv358333yT9evX88wzz3DhhRdGbXf33Xdz8skns3XrVr71rW9x//33d3icmhQ6mHf/fnZdtBBP0R6G/v73OOfMaVM/Pn+AH6/4jE17K3nsvKmMH5LWwZEqFZu//vWvHH300UydOpVzzjmHmpoaAG644QbGjRvHxIkTufHGG/nXv/7FqlWruO6669q0lVHn+eefZ8KECYwfP55bbrkl/Pzvf/97Ro8ezdy5c7n00kv56U9/CsDq1auZMWMGcaFrl3/44YdMnDiR2bNnc8MNNzB58mQAtm/fzre+9S2mTJnCtGnT+OijjwB45513OO644zjrrLMYNWoUt956K88++ywzZsxg4sSJ4e9xwQUXcPXVV3PccccxcuRI3n//fRYuXMiYMWO45JJLwnFefvnlTJ8+nSOPPJI777wz/PzcuXN566238Pv9Tb7z1KlTGTQoeDThhAkTqK6uxuv1Nmn32muvsXDhQgAWLlzIq6++2qZl3CIR6VG3adOmSXfl2btXtn33JPlqylSpWbOmzf0EAgG57dX1MuzGN+TZD3Z2YISqO9m4cWNXh9DE0qVL5eqrrw4//uabb+TYY4+VmpoaERG566675O6775Z9+/bJuHHjJBAIiIhIWVmZiIicf/758sorr7T6c+fMmSOfffaZFBYWyrBhw+TAgQPi8Xjk2GOPlddff112794t+fn5UlpaKm63W44++mi59tprRUTklltukccffzzc15gxY+Sjjz4SEZHrr79eJk2aJCIiNTU1UltbKyIimzZtkpkzZ4qIyOrVqyUjI0P27dsntbW1MmDAALnjjjtEROTBBx+U66+/Pvzdzj//fBEReemll6Rfv36yYcMG8fv9MmnSJFm/fr2IiJSUlIiIiNfrlWOOOUY2bNgQjm3u3Lmybt26FpfFihUr5KSTTor6WlpaWvi+3++XjIyMqO2i/W0BayWGMdbSHc3GmHnAo0AcsERE7o3S5gfArwEBPheR86yMySre4mJ2LVyEv7SUoUuWkDx1Spv7evrfX/PsB7u47FvDuXDWsA6MUnVXd7y+gY3FlR3a57jB/fjVgiPb1cd///tfNm7cyOzZswHweDwcc8wxZGZmYrPZuOyyy5g/fz6nntq2824a++ijjzj++OPJzg5eD+S8887j/fffx+Vycfzxx5ORkQHAWWedxe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+6PULuACs7e8jmO2dU1LNhiRpIrIr1yS5epiPiM3KwH9Wrwf9wNy7xyPgeuzeS9zsQPjfR2bDW6lmKOPA7VpBEBHbkm6SfXQ/DRpczYOWXRDsMPFKwczMGv5NwczMGi4KZmbWcFEwM7OGi4KZmTVcFMzMrOGiYGZmjV9g8tC+mOCk+gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "Otto_SVM_result = pd.read_csv(\"Otto_SVM_result_2.csv\")\n",
    "accuracy_s1 = Otto_SVM_result['accuracy']\n",
    "\n",
    "C_s = np.logspace(-1, 3, 5)# logspace(a,b,N)把10的a次方到10的b次方区间分成N份 \n",
    "gamma_s = np.logspace(-2, 2, 5)  \n",
    "accuracy_s1 =np.array(accuracy_s1).reshape(len(C_s),len(gamma_s))\n",
    "\n",
    "x_axis = np.log10(C_s)\n",
    "for j, gamma in enumerate(gamma_s):\n",
    "    plt.plot(x_axis, np.array(accuracy_s1[:,j]), label = ' Test - log(gamma)' + str(np.log10(gamma)))\n",
    "\n",
    "plt.legend()\n",
    "plt.xlabel( 'log(C)' )                                                                                                      \n",
    "plt.ylabel( 'accuracy' )\n",
    "plt.savefig('RBF_SVM_Otto.png' )\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xt8VPWd//HXZ3KbJIQkBAQkiaCi3BMgIIJ20dp6RW2Xrpe1RdfLumq36upW++t2u1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mXobichApqTQz1rLRlfOvJLDc1Q2EpGBRUmhH0WXjZZMWZLocEREDqCk0E+cc9z86s0qG4nIgKak0E+e2vwUT3/6tMpGIjKgKSn0A5WNRGSwUFIImMpGIjKYKCkETGUjERlMlBQCpLKRiAw2SgoBUdlIRAaj5EQHcLBauXklT3/6NNfMvkZlI4mpsbGR8vJy6urqEh2KHETC4TD5+fmkpKT06P1KCgHYWbuTm9fcrLKRdKq8vJysrCzGjx+PmSU6HDkIOOeoqKigvLycCRMm9GgZKh/1MZWNJF51dXXk5eUpIUifMTPy8vJ6dfSppNDHWstG6m0k8VBCkL7W298pJYU+1Fo2mj5yuobElkHlmGOOobi4mMLCQkaNGkVxcTHFxcVs3ry5W8t59NFHef/997v9+ccddxzr1q3r9vta/fSnP+V//ud/evz+/vCNb3yDjz/+OOa8L774goULF5KZmcnVV1/d4TIqKir48pe/zMSJEzn55JOpqqrq8ziVFPpIdNnopgU3kRzS6RoZPNasWcO6detYunQp55xzDuvWrWPdunWMHz++W8vpaVLojcbGRh566CHOOeecfv3c7rr88sv57//+75jzMjIyuPnmm7nttts6XcbNN9/MqaeeysaNGzn++OP5yU9+0udxKin0EZWN5GC1YsUKjj32WGbNmsU555zDvn37ALj++uuZMmUKM2bM4Lvf/S4vvvgiy5cv55prrunRUUar3/72t0yfPp1p06bxve99z5/+i1/8gqOOOoqFCxdyySWX+HvUq1atYs6cOSQleefvXn31VWbMmMH8+fO5/vrrKS4uBuCjjz7i+OOPZ+bMmcyePZs1a9YA8PTTT3PCCSewePFiJk6cyPe//30efPBB5syZw4wZM/zvccEFF3DllVdywgkncMQRR/DCCy+wZMkSJk2axMUXX+zHedlll1FSUsLUqVNZunSpP33hwoU89dRTNDc3H/Cdhw0bxoIFCwiHw52um8cff5wlS7zOK0uWLOGxxx7r7urtknZn+4DKRtJb//XX91i/rbpPlznl0OH856KpvVrGF198wa233sozzzzj783eeeedXHzxxSxfvpz33nsPM6OyspKcnBxOO+00Fi9ezNlnn92jzysvL+f73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ZUrV7aZv3HjRqZOncrixYv99RFvQgA488wzeeCBBwB44IEHOOuss/o0fgi2fDQX2OSc+9g51wA8AsT6Bj8CfgIMqmv9VTaSoWD06NH8+te/5pxzzqGoqIj58+fz4YcfUlVVxemnn05RUREnnngiP/vZzwA477zzuOWWW3p8ojk/P5+lS5eycOFCiouLmTdvHqeffjqFhYVcf/31zJ07l69+9atMnTqV7OxsAE477TSef/55fxn33XcfF110EfPnzycUCvntrrrqKu69917mzZvHli1b2uzp95VZs2YxZcoUpk2bxqWXXsqCBQv8edu2bSM7O9svdcX67v/+7//Or3/9a/Lz8/nggw8A7xxJa3fd733vezz55JNMnDiRF154geuvv77PvwPOuUAewGK8klHr628Cd7VrMxP4c+T5c0BJB8u6DCgFSgsLC91AsOLjFW7a/dPcvW/fm+hQZJBav359okMYVPbs2eOcc66hocGdeuqpbtmyZf68RYsWuY8++qhNO+ecu+mmm9y1117bv4F24Cc/+Ym7//77++WzYv1uAaUujm13kEcKsc6A+MdrZhYC7gD+rasFOed+6Zwrcc6VdJRl+1NFbYXKRiL97D/+4z+YOXMmM2bM4Oijj+aMM87w5912223+Cdxly5ZRXFzMtGnTeOWVV7jxxhsTFXIbeXl5XHDBBYkOo0tB1jzKgYKo1/lA9Gn3LGAa8FzkDPoYYJmZnekG8Mlm5xw3r7mZfY37+NGCH6lsJNJP7rjjjg7nTZ482X9+/vnnt+l1NFD80z/9U6JDiEuQRwprgYlmNsHMUoFzgWWtM51zVc65kc658c658cCrwIBOCOD1Nlq1ZRVXFl/JETlHJDocEZE+FVhScM41AVcBK4ENwB+cc++Z2VIzOzOozw2SykYicrALtPbhnFsOLG83LWZ/NOfcwiBj6S2VjURkKNAVzXFauUVlIxE5+CkpxKGitoJbXr1FZSM5aGno7OC1Hzp77dq1TJs2jSOPPJJrrrkm5nucc1xxxRUceeSRFBUV9WodxUtJoQutZaO9jXtVNpKDlobODl77obMvv/xyfvOb37Bx40bee+89Vq1adcB7/vrXv1JWVsamTZu4++67ufLKKw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6844+r39RX53BnAm5HY3gV+EJneL3+TuqJZRER8Kh+JiIhPSUFERHxKCiIi4lNSEBERn5KCiIj4lBREYjCzvV236vT9f4pciY6ZDTOzX5jZR5FRL18ws2PMLDXyfNBfRCoHDyUFkT4WGSMnyTn3cWTSvXhXm050zk3FG911pPMG+nsGOCchgYrEoKQg0onIVbb/bWbvmtk7ZnZOZHooMuzBe2b2hJktN7PFkbf9I5Gr1M3sCOAY4PvOuRbwhi1xzj0ZaftYpL3IgKDDVpHOfR0oBoqAkcBaM3sBb9iR8cB0vFFuNwD3Rd6zAO/qYoCpwDrnDXAWy7vAnEAiF+kBHSmIdO44vJFYm51znwPP423EjwP+6Jxrcc59hjfMRquxwI54Fh5JFg1mltXHcYv0iJKCSOc6unFJZzc0qcUbmwa8sXOKzKyzv7U0oK4HsYn0OSUFkc69AJwTuenJKLxbXr4GvIR3g5+QmY3Gu3Vjqw3AkQDOu/9FKfBfUSNuTjSzsyLP84AdzrnG/vpCIp1RUhDp3F/wRqt8C3gW+PdIuejPeCORvgv8Au+uXVWR9zxJ2yRxCd4NlzaZ2Tt4935ovV/ACcDyYL+CSPw0SqpID5nZMOfdlSsP7+hhgXPus8gY+Ksjrzs6wdy6jEeBG13X9xIX6RfqfSTSc09EboaSCvwocgSBc67WzP4T7z66n3b05sjNgx5TQpCBREcKIiLi0zkFERHxKSmIiIhPSUFERHxKCiIi4lNSEBERn5KCiIj4/j98m83uDv8OIQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#未降维的RBFSVM结果图\n",
    "Otto_SVM_result_1 = pd.read_csv(\"Otto_SVM_result.csv\")\n",
    "accuracy_s2 = Otto_SVM_result_1['accuracy']\n",
    "\n",
    "C_s = np.logspace(-1, 3, 5)# logspace(a,b,N)把10的a次方到10的b次方区间分成N份 \n",
    "gamma_s = np.logspace(-1, 1, 3)  \n",
    "accuracy_s2 =np.array(accuracy_s2).reshape(len(C_s),len(gamma_s))\n",
    "\n",
    "x_axis = np.log10(C_s)\n",
    "for j, gamma in enumerate(gamma_s):\n",
    "    plt.plot(x_axis, np.array(accuracy_s2[:,j]), label = ' Test - log(gamma)' + str(np.log10(gamma)))\n",
    "\n",
    "plt.legend()\n",
    "plt.xlabel( 'log(C)' )                                                                                                      \n",
    "plt.ylabel( 'accuracy' )\n",
    "plt.savefig('RBF_SVM_Otto1.png' )\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n",
    "    由以上两图可知：\n",
    "    使用PCA降维数据进行调优的最佳参数为：C= 10 ，gamma = 1.0，accuracy=0.78426307876171。\n",
    "    未使用PCA降维数据进行调优的最佳参数为：C= 10 ，gamma = 1.0，accuracy= 0.79181926828328 。\n",
    "    使用PCA降维精度值仅比未使用PCA降维的精度值低约0.007556。在数据总条数相同的情况下，降维前有186维，降维后为48维，下降约3/4，好处直接体现在运行时间上，降维后运行一次的时间仅为2分多点，并且gamma 值调优我用了五个值，比未降维前的3个gamma值运行时还要快许多，但最佳精度值却相差很小，由此可以说明PCA降维可以在保证精度的情况下有效提高效率。\n",
    "    \n",
    "    "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
